package vip.liux.contracts.shared.enums.pay;

import lombok.Getter;
import vip.liux.core.enums.IEnum;

import java.util.Arrays;
import java.util.Objects;

/**
 * 钱包交易业务分类
 *
 * @author jason
 */
@Getter
public enum PayWalletBizType implements IEnum {

    RECHARGE(1, "充值"),
    RECHARGE_REFUND(2, "充值退款"),
    PAYMENT(3, "支付"),
    PAYMENT_REFUND(4, "支付退款"),
    UPDATE_BALANCE(5, "更新余额"),
    TRANSFER(6, "转账");

    /**
     * 类型
     */
    private final int value;
    /**
     * 名字
     */
    private final String desc;

    PayWalletBizType(int value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    public static PayWalletBizType valueOf(Integer type) {
        return Arrays.stream(values()).filter(item -> Objects.equals(item.getValue(), type)).findFirst().orElse(null);
    }

}
